const {
    LinValidator,
    Rule
} = require('../../core/lin-validator-v2')

class PositiveIdValidator extends LinValidator {
    constructor() {
        super();
        this.id = new Rule('isInt', 'id必须为正整数', {
            min: 1
        });
    }
}
class optionsIdValidator extends LinValidator {
    constructor() {
        super();
        this.id = [
            new Rule('isOptional'),
            new Rule('isInt', 'id必须为正整数', {
                min: 1
            })
        ]
    }
}
class PaginateValidator extends LinValidator {
    constructor() {
        super();
        this.count = [
            new Rule('isOptional', '', 10),
            new Rule('isInt', 'count必须为正整数', {
                min: 1
            })
        ];
        this.start = [
            new Rule('isOptional', '', 0),
            new Rule('isInt', '必须为整数，且大于等于0', {
                min: 0
            })
        ];
    }
}

module.exports = {
    PositiveIdValidator,
    PaginateValidator,
    optionsIdValidator,
}